package com.lzh.persevere.controller;

import com.lzh.persevere.common.R;
import com.lzh.persevere.common.ResultUtil;
import com.lzh.persevere.model.qo.PageModelQO;
import com.lzh.persevere.model.qo.collectarticle.PageCollectArticle;
import com.lzh.persevere.model.vo.article.ArticleDetailVO;
import com.lzh.persevere.model.vo.fanInfo.FanInfoVO;
import com.lzh.persevere.service.CollectArticleInfoService;
import com.lzh.persevere.service.FanInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * 创作中心controller
 *
 * @author luzhiheng
 * @since 2025-07-15
 */
@Api(tags = "创作中心")
@RestController
@RequestMapping("/createCenter")
public class CreateCenterController {

    @Resource
    private CollectArticleInfoService collectArticleInfoService;

    @Resource
    private FanInfoService fanInfoService;

    @ApiOperation(value = "查询收藏的文章列表")
    @PostMapping("/findCollectArticleList")
    public R<Map<String,Object>> findCollectArticleList(@RequestBody PageCollectArticle qo) {
        return ResultUtil.success(collectArticleInfoService.findCollectArticleList(qo));
    }

    @ApiOperation(value = "查询粉丝列表")
    @PostMapping("/findFanList")
    public R<List<FanInfoVO>> findFanList() {
        return ResultUtil.success(fanInfoService.findFanList());
    }

    @ApiOperation(value = "查询关注列表")
    @PostMapping("/findFollowList")
    public R<List<FanInfoVO>> findFollowList() {
        return ResultUtil.success(fanInfoService.findFollowList());
    }

    @ApiOperation(value = "关注/取消关注")
    @PostMapping("/followOrCancel/{userId}/{status}")
    public R<Boolean> followOrCancel(@PathVariable String userId, @PathVariable Integer status) {
        return ResultUtil.success(fanInfoService.followOrCancel(userId, status));
    }

    @ApiOperation(value = "查询创作信息")
    @PostMapping("/findCreateInfo")
    public R<Map<String,Object>> findCreateInfo() {
        return ResultUtil.success(fanInfoService.findCreateInfo());
    }


}
